#ifndef _GUIFEEDER_H_
#define _GUIFEEDER_H_

#include "GUIBase.h"
#include "FeederAgent.h"
#include "Part.h"
#include "GUILane.h"
#include "Bin.h"
#include <vector>

class Feeder;
class FeederAgent;
class Part;
class GUILane;
class Bin;
class QGraphicsScene;

enum FeederColor
{
	FeederColor_Yellow,
	FeederColor_Purple,
	FeederColor_Green,
	FeederColor_Red,
};

enum FeederState
{
	FeederOff,
	FeederPurging,
	FeederDropping
};

class GUIFeeder : public GUIBase
{
public:
	FeederAgent* agent;
	GUILane* topLane;
	GUILane* bottomLane;
	std::vector<Part*> partsInFeeder;
	FeederState state;
	int feederNumber;
	int dropInThisLane;
	float angle;
	std::vector<Part*> partsBeingPurged;
	Bin* purgeBin;
	bool broken; // Non-normative

	GUIFeeder(int X, int Y, FeederAgent* myAgent, GUILane* myTopLane, GUILane* myBottomLane, int myFeederNumber, FeederColor feederColor = FeederColor_Green);
	~GUIFeeder();

	void HereAreBinParts(std::vector<Part*> &parts); // Called by GUIGantry
	void HereIsPurgeBin(Bin* bin); // Called by GUIGantry
	void DoDropInLane(int lane); // Called by FeederAgent
	void DoPurge(); // Called by FeederAgent
	void DropAPart();
	bool hasPurgeBin(); // Checked by GUIGantry
	void Purge();

	// Animation
	QGraphicsPixmapItem *imgDiverter;
	void openHatch(int lane);
	void advance(int phase); // Override GUIBase

	// Non-normative
	void DoBreak(); // Override GUIBase
	void DoFix(); // Override GUIBase
};

#endif